#include "Game_01.hpp"
#include <cmath>
#include <iostream>


static void gun_direction(int key)
{
#ifdef CONTROL_BY_MOUSE
	return;
#endif
	switch (key)
	{
	case LEFT:
		if (fortInstance.angle <= 180 - GAME::D_ANGLE)
			fortInstance.angle += GAME::D_ANGLE;
		break;
	case RIGHT:
		if (fortInstance.angle >= GAME::D_ANGLE)
			fortInstance.angle -= GAME::D_ANGLE;
		break;
	case UP:
		std::cout << "...\n";
		GAME::bombsInstance.add();
		break;
	default:	return;
	}
#ifdef _DEBUG
	printf("angle:%d\tsin:%.2f,con:%.2f\n",
		fortInstance.angle,
		sin(M_PI * fortInstance.angle / 360),
		cos(M_PI * fortInstance.angle / 360)
	);
#endif

}
void Listener::keyboardListener(int key, int event)
{
	if (event == KEY_UP)return;
	gun_direction(key);
}
